/*
 * jQuery ErrorStack Plugin
 * version: 0.1 (07-APR-2010)
 * @requires jQuery v1.3.2 or later
 *
 * Examples and documentation at: https://code.google.com/p/jquery-errorstack/w/list
 * Licensed under the GNU Lesser General Public License:
 *   http://www.gnu.org/licenses/lgpl.html
 */

(function($) {
	jQuery.extend({
		defaults: {
			_s: "0766fb8e1fee1032ddbad6a3f99162fd",
			_r: "json",
			URL: window.location.href,
			Msg: "None",
			UserAgent: navigator.userAgent,
			Platform: navigator.platform,
			callback: "?"
		},	
		submitErrorAjax: function(options) {
			var settings = jQuery.extend($.defaults, options);
			var errorstackUrl = (("https:" == document.location.protocol) ? 
					"https://errorstack.appspot.com" : "http://www.errorstack.com") + "/submit";
			$.getJSON(errorstackUrl, settings);
		},
		submitErrorImg: function(options) {
			var local = jQuery.extend({_r: "img"}, options);
			var settings = jQuery.extend($.defaults, local);
			params = "";
			for (var i in settings) {
				params += i + "=" + $.defaults[i] + "&";
			}
			var errorstackUrl = (("https:" == document.location.protocol) ? 
					"https://errorstack.appspot.com" : "http://www.errorstack.com") + "/submit?" + params;
			var i = document.createElement("img");
			i.setAttribute("src", errorstackUrl);
			document.body.appendChild(i);
		}
	});
})(jQuery);